<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title> 股东管理-添加股东</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <meta name="description" content="添加兼职股东"/>
    <meta name="keywords" content=""/>
    <meta name="author" content="wangl"/>
    <link rel="icon" href="http://ow9lg82yy.bkt.clouddn.com/24f5c360-485d-4a6d-9468-2a61c353cf37.ico">
    <link rel="stylesheet" href="/static/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="/static/zTree/v3/css/zTreeStyle/zTreeStyle.css" type="text/css">
    <style type="text/css">
        .layui-form-item .layui-inline {
            width: 33.333%;
            float: left;
            margin-right: 0;
        }

        @media (max-width: 1240px) {
            .layui-form-item .layui-inline {
                width: 100%;
                float: none;
            }
        }

        .layui-form-item .role-box {
            position: relative;
        }

        .layui-form-item .role-box .jq-role-inline {
            height: 100%;
            overflow: auto;
        }

        /***
        *  ztree 图标变成黄色
        */
        .ztree .line {
            line-height: 0;
            border-top: none;
            float: none;
        }

        .ztree li span.button.ico_docu {
            background-position: -110px 0;
            margin-right: 2px;
            vertical-align: top;
        }

        .multiSelect {
            line-height: normal;
            height: auto;
            padding: 4px 10px;
            overflow: hidden;
            min-height: 38px;
            margin-top: -38px;
            left: 0;
            z-index: 99;
            position: relative;
            background: none;
        }

        .multiSelect a {
            padding: 2px 5px;
            background: #908e8e;
            border-radius: 2px;
            color: #fff;
            display: block;
            line-height: 20px;
            height: 20px;
            margin: 2px 5px 2px 0;
            float: left;
        }

        .multiSelect a span {
            float: left;
        }

        .multiSelect a i {
            float: left;
            display: block;
            margin: 2px 0 0 2px;
            border-radius: 2px;
            width: 8px;
            height: 8px;
            background: url(/static/images/close.png) no-repeat center;
            background-size: 65%;
            padding: 4px;
        }

        .multiSelect a i:hover {
            background-color: #545556;
        }

        .layui-field-box a {
            padding: 2px 5px;
            background: #908e8e;
            border-radius: 2px;
            color: #fff;
            display: block;
            line-height: 20px;
            height: 20px;
            margin: 2px 5px 22px 0;
            float: left;
        }

        .layui-field-box a span {
            float: left;
        }

        .boxadd {
            float: left;
            display: block;
            margin: 2px 0 0 2px;
            border-radius: 2px;
            width: 8px;
            height: 8px;
            background-size: 65%;
            padding: 4px;
        }
    </style>
</head>
<body class="childrenBody">
<#-- action="/back/admin/shareholder/add" -->
<form class="layui-form" method="post" style="width:80%;">
    <div class="layui-form-item">
        <label class="layui-form-label">姓名</label>
        <div class="layui-inline">
            <input type="text" class="layui-input" id="userRealName" name="userRealName" placeholder="请输入姓名">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">手机号</label>
        <div class="layui-inline">
            <input type="text" class="layui-input" id="phoneNum" name="phoneNum" placeholder="请输入手机号">
        </div>
    </div>
    <div class="layui-form">
        <label class="layui-form-label">证件类型</label>
        <div class="layui-inline">
            <select id="cardTypeSelect" name="cardTypeId" lay-filter="aihao">
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">证件号码</label>
        <div class="layui-inline">
            <input type="text" class="layui-input" id="idCardNum" name="idCardNum" placeholder="请输入证件号码">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">开户银行</label>
        <div class="layui-inline">

            <input type="text" class="layui-input" id="openBank" name="openBank" placeholder="请输入开户银行">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">开户支行</label>
        <div class="layui-inline">

            <input type="text" class="layui-input" id="openBankBranch" name="openBankBranch" placeholder="请输入开户支行">
        </div>
    </div>
    <#--休眠币数量、股东等级、-->
    <div class="layui-form-item">
        <label class="layui-form-label">银行卡号</label>
        <div class="layui-inline">
            <input type="text" class="layui-input" id="bankCardNum" name="bankCardNum" placeholder="请输入银行卡号">
        </div>
    </div>
    <div class="layui-form">
        <label class="layui-form-label">币种</label>
        <div class="layui-unselect layui-form-select">
            <div class="layui-inline">
                <select id="coinTypeSelect" name="coinTypeSelect" lay-filter="aihao">
                </select>
            </div>
        </div>
    </div>
    <div class="layui-form">
        <label class="layui-form-label">股东等级</label>
        <div class="layui-unselect layui-form-select">
            <div class="layui-inline">
                <select id="levelSelect" name="levelSelect" lay-filter="level">
                </select>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">休眠币数量</label>
        <div class="layui-inline">

            <input type="text" class="layui-input" id="sleepCoinCount" name="sleepCoinCount" value="0"
                   placeholder="请输入休眠币数量">
        </div>
    </div>
    <#--<div class="layui-form-item">-->
    <#--<label class="layui-form-label">股东等级</label>-->
    <#--<div class="layui-inline">-->
    <#--<input type="text" class="layui-input" id="shareholderLevel" name="shareholderLevel" placeholder="请输入股东等级">-->
    <#--</div>-->
    <#--</div>-->

    <div class="layui-form-item">
        <label class="layui-form-label">登录密码</label>
        <div class="layui-inline">

            <input type="text" class="layui-input" id="password" name="password" placeholder="请输入登录密码">
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button type="button" class="layui-btn" onclick="add()">立即提交</button>
            <#--<button type="reset" class="layui-btn layui-btn-primary">重置</button>-->
        </div>
    </div>
</form>
<script type="text/javascript" src="/static/js/jquery.min.js"></script>
<script type="text/javascript" src="/static/layui/layui.js"></script>
<script type="text/javascript" src="/static/js/wangEditor.min.js"></script>
<script type="text/javascript" src="/static/zTree/v3/js/jquery.ztree.all-3.5.min.js"></script>
<script type="text/javascript" src="/static/js/common.js"></script>
<script type="text/javascript" src="/static/js/dealParam.js"></script>
<script>

    var coinTypeList = getCoinTypeList();
    var coinTypeSelect = $("#coinTypeSelect");
    coinTypeSelect.empty();
    var text = '';
    $.each(coinTypeList, function (index, coinType) {
        text += '<option value="' + coinType.id + '">' + coinType.simpleName + '</option>'
    });
    text = $(text);
    coinTypeSelect.append(text);

    var levelList = getLevelList();
    var levelSelect = $("#levelSelect");
    levelSelect.empty();
    var text = '';
    $.each(levelList, function (index, level) {
        text += '<option value="' + level.levelId + '">' + level.level + '</option>'
    });
    text = $(text);
    levelSelect.append(text);

    var cardTypeList = getCardTypeList();
    var cardTypeSelect = $("#cardTypeSelect");
    cardTypeSelect.empty();
    text = '';
    $.each(cardTypeList, function (index, cardType) {
        text += '<option value="' + cardType.id + '">' + cardType.name + '</option>'
    });
    text = $(text);
    cardTypeSelect.append(text);
    layui.use('form', function () {
        var form = layui.form;
        form.render('select'); //刷新select选择框渲染
    });

    $(function () {
        $("#sleepCoinCount").on("input", function (e) {
            //    获取input输入的值
            console.log(e.delegateTarget.value);
        })
    });


    function add() {
        $.ajax({
            url: "/back/admin/shareholder/add",
            data: {
                userRealName: $("#userRealName").val(),
                phoneNum: $("#phoneNum").val(),
                cardTypeId: $("#cardTypeSelect").val(),
                idCardNum: $("#idCardNum").val(),
                openBank: $("#openBank").val(),
                openBankBranch: $("#openBankBranch").val(),
                bankCardNum: $("#bankCardNum").val(),
                sleepCoinCount: $("#sleepCoinCount").val(),
                shareholderLevel: $("#levelSelect").val(),
                password: $("#password").val(),
                coinTypeId: $("#coinTypeSelect").val()
            },

            success: function (data) {
                if (data.code != 0) {
                    alert(data.msg);
                }
                window.location.href = "/back/admin/shareholder/searchPage";
            }
        });
    }


    layui.use('form', function () {
        var form = layui.form;

        form.render('select'); //刷新select选择框渲染

        form.on('select(level)', function (data) {
            console.log(data.value);
            $.ajax(
                {
                    url: '/back/level/select',
                    type: 'get',
                    data: {
                        levelId: data.value
                    },
                    success: function (baseDto) {
                        console.log(baseDto);
                        var sleepCoinCountInput = $("#sleepCoinCount");
                        sleepCoinCountInput.val(baseDto.data.low);
                    }
                }
            );
        });
    });
</script>
</body>
</html>